#include "noria.h"

using namespace tp1;

const float Noria::RADIUS_BIG_WHEEL = 8;
const float Noria::RADIUS_SMALL_WHEEL = 4;

const int Noria::QDIVISIONS_BIG_WHEEL = 15;
const int Noria::QDIVISIONS_SMALL_WHEEL = 9;

const float Noria::RADIUS_CYLINDERS_WHEELS = 0.2f;
const int Noria::SIDES_CYLIINDERS_WHEELS = 4;

const float Noria::HEIGHT_SUPPORT = 15;
		
const float Noria::RADIUS_CYLINDERS_SUPPORT = 0.2f;
const float Noria::SIDES_CYLINDERS_SUPPORT = 4;

const float Noria::BASE_CABIN = 1.35f;
const float Noria::HEIGHT_CABIN = 2.0f;

const int Noria::Q_SMALL_WHEELS = 3;
const int Noria::Q_CABINS_FOR_WHEEL = 3;

Noria::Noria()
{
	c = new Cabin(BASE_CABIN,HEIGHT_CABIN);
	w = new WheelComposite(RADIUS_SMALL_WHEEL,QDIVISIONS_SMALL_WHEEL,RADIUS_CYLINDERS_WHEELS,SIDES_CYLIINDERS_WHEELS,c);

	m_wheel = new WheelComposite(RADIUS_BIG_WHEEL,QDIVISIONS_BIG_WHEEL,RADIUS_CYLINDERS_WHEELS,SIDES_CYLIINDERS_WHEELS,w);
	//m_support = new Support(BASE_SUPPORT,HEIGHT_SUPPORT,RADIUS_CYLINDERS_SUPPORT,SIDES_CYLINDERS_SUPPORT);
	//m_cabin = new Cabin(BASE_CABIN,HEIGHT_CABIN);

	//m_cylinder = new Cylinder(RADIUS_CYLINDERS_WHEELS,m_wheel->Width(),SIDES_CYLIINDERS_WHEELS);
}


Noria::~Noria(void)
{
	delete c;
	delete w;
	delete m_wheel;
	//delete m_support;
	//delete m_cabin;
}

void Noria::Update(float angle_big_wheel,float angle_second_wheel)
{
	m_rotationBigWheel = angle_big_wheel;
	m_rotationSmallWheel = angle_second_wheel;
}

void Noria::Render()
{
	m_wheel->Render();

	// //Dibujo del soporte de la noria.
	//glPushMatrix();
	//	m_support->Draw();
	//glPopMatrix();

	////Cilindro que une las dos ruedas grandes.
	//glPushMatrix();
	//	glTranslatef(0,-m_wheel->Width(),0);
	//	glRotatef(90,1,0,0);
	//	m_cylinder->Draw();
	//glPopMatrix();
}
